//
//  MYMenuTableViewCell.m
//  奇闻
//
//  Created by yangbin on 15/1/2.
//  Copyright (c) 2015年 MingYueGuCheng. All rights reserved.
//

#import "MYMenuTableViewCell.h"
#import "MYBaseMenu.h"

@interface MYMenuTableViewCell ()
@property (nonatomic, copy) MYMenuTableViewCellBlock operateBlock;//cell点击回调方法
@end
@implementation MYMenuTableViewCell

- (void)setMenu:(MYBaseMenu *)menu
{
    if (nil == _menu) {
        _menu = menu;
        self.textLabel.text = menu.name;
        self.operateBlock = menu.operateBlock;
    }
}
/*********抽屉视图效果**********/
- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
        self.backgroundColor = [UIColor clearColor];
        self.textLabel.textColor = [UIColor whiteColor];

        self.selectionStyle = UITableViewCellSelectionStyleNone;
    }
    return self;
}
- (void)setSelected:(BOOL)selected animated:(BOOL)animated
{
    [super setSelected:selected animated:animated];
   
    if (selected) {
        self.contentView.backgroundColor = [UIColor colorWithWhite:1.0 alpha:0.2];
        self.contentView.alpha = 0.2;
        if (self.operateBlock) {
            self.operateBlock();
        }
    }
    else
    {
        self.contentView.alpha = 1.0;
        self.contentView.backgroundColor = [UIColor clearColor];
    }
}
/*********抽屉视图效果 完**********/
@end
